﻿
@{
    ViewBag.Title = "用车申请";
    Layout = "~/Views/Shared/_BaseLayout.cshtml";
    Sc.Domain.Car_UseCarApplication ent = ViewData["ent"] as Sc.Domain.Car_UseCarApplication;
    var isApproal = ViewData["isApproal"].ToString();
    var instate = "创建";
}
<script src="~/Content/laypage-v1.3/laypage/laypage.js"></script>
<script src="~/Content/layer-v2.1/layer/extend/layer.ext.js"></script>
<div class="formbody">
    <div class="formtitle"><span>用车申请</span></div>
    <form method="post" enctype="multipart/form-data" class="jqtransform" id="formData">
        <table style="width:98%;margin-left:20px;line-height:48px;">
            <tr>
                <td><label>出发地</label></td>
                <td><input name="StartAddress" type="text" class="dfinput" id="txtStartAddress" value="@ent.StartAddress" /></td>
                <td><label>目的地</label></td>
                <td><input name="EndAddress" type="text" class="dfinput" id="txtEndAddress" value="@ent.EndAddress" /></td>
            </tr>
            <tr>
                <td><label>出发时间</label></td>
                <td><input name="StartTime" type="text" class="dfinput" id="txtStartTime" value="@ent.StartTime.ToString("yyyy年MM月dd日 HH时mm分")" /></td>
                <td><label>预计返程时间</label></td>
                <td><input name="ExDate" type="text" class="dfinput" id="txtExDate" value="@ent.ExDate.ToString("yyyy年MM月dd日 HH时mm分")" /></td>
            </tr>
            <tr>
                <td><label>乘车人数</label></td>
                <td><input name="TotalCount" type="text" class="dfinput" id="txtTotalCount" value="@ent.TotalCount" /></td>
                <td><label>载重吨位</label></td>
                <td><input name="ZcTonnage" type="text" class="dfinput" id="txtZcTonnage" value="@ent.ZcTonnage" /></td>
            </tr>
            <tr>
                <td><label>用车事由</label></td>
                <td><input name="Reson" type="text" class="dfinput" id="txtReson" value="@ent.Reson" /></td>
                <td><label>备注</label></td>
                <td><input name="Remark" type="text" class="dfinput" id="txtRemark" value="@ent.Remark" /></td>
            </tr>
        </table>
    </form>
    
    <div class="formtitle"><span>审核意见</span></div>
    <table class="imgtable">
        <tbody style="line-height:35px;">
            @if (ent.OpinionList == null || ent.OpinionList.Count == 0)
            {
                <tr>
                    <td>无审核意见</td>
                </tr>
            }
            @foreach (var item in ent.OpinionList)
            {
                switch (ent.InstanceState)
                {
                    case 0:
                        instate = "创建";
                        break;
                    case 1:
                        instate = "审核中";
                        break;
                    case 2:
                        instate = "拒绝";
                        break;
                    case 3:
                        instate = "审核通过，等待派车";
                        break;
                    case 4:
                        instate = "派车";
                        break;
                    case 5:
                        instate = "还车";
                        break;
                    case 6:
                        instate = "拒绝派车";
                        break;
                    default:
                        instate = "未知状态";
                        break;
                }
                <tr>
                    <td>审 核 人：@item.UserName <p>审核结果：【@instate】<p>
                    <p>审核意见：@item.Context<p>审核时间：@item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")</p></td>
                </tr>
                    }
        </tbody>
    </table>
    <div class="formtitle"><span>所派车辆</span></div>
    @if (ViewData["sendcarlist"] == null)
                {
        <span>无派车信息</span>
    }
    else
    {
        List<Sc.Domain.SendCarTemp> sendcarlist = ViewData["sendcarlist"] as List<Sc.Domain.SendCarTemp>;
        <table class="tablelist">
            <thead>
                <tr>
                    <th>车牌号</th>
                    <th>驾驶员</th>
                    <th>驾驶员电话</th>
                    <th>申请人</th>
                    <th>申请人电话</th>
                    <th>车型</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in sendcarlist)
                {
                    <tr>
                        <td>@item.CarNo</td>
                        <td>@item.DriverName</td>
                        <td>@item.DriverPhone</td>
                        <td>@item.UserName</td>
                        <td>@item.UserPhone</td>
                        <td>@item.CarTypeName</td>
                    </tr>
                }
            </tbody>
        </table>
    }

</div>
